package com.example;



import com.example.fruit.Apple;
import com.example.fruit.Fruit;
import com.example.fruit.Mango;
import com.example.fruit.Strawberry;
import com.example.strategy.StrategyA;
import com.example.strategy.StrategyB;
import com.example.strategy.StrategyC;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;


public class Test {

    public static void main(String[] args) {
        Fruit fruit1 = new Apple(new BigDecimal(1));
        Fruit fruit2 = new Strawberry(new BigDecimal(10));
        Fruit fruit3 = new Mango(new BigDecimal(2));


        List<Fruit> fruitList = new ArrayList<>();
        fruitList.add(fruit1);
        fruitList.add(fruit2);
        fruitList.add(fruit3);

        List<Discount> discountList = new ArrayList<>();
        discountList.add(new Discount("草莓",new BigDecimal(0.8)));

        Supermarket supermarket = new Supermarket(fruitList,new StrategyA(),discountList);
        System.out.println("折扣前："+supermarket.getMoney());

        supermarket.setStrategy(new StrategyB());
        System.out.println("折扣后："+supermarket.getMoney());

        supermarket.setStrategy(new StrategyC());
        System.out.println("折扣+满减："+supermarket.getMoney());
    }

}
